﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel.DataAnnotations;
using Ama.BugTracker.Web.Resources;

namespace Ama.BugTracker.Models
{
    public class LoginInfo
    {
        private string userName;
        private string password;
        private bool rememberMe;

        public LoginInfo(string username, string password)
        {
            this.UserName = username;
            this.Password = password;
        }

        [Display(Name = "UserNameLabel", ResourceType = typeof(RegistrationDataResources))]
        [Required(ErrorMessage = "用户名 字段是必须的！")]
        public string UserName
        {
            get { return userName; }
            set
            {
                if (this.userName != value)
                {
                    Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "UserName" });
                    userName = value;
                }
            }
        }

        [Display(Name = "PasswordLabel", ResourceType = typeof(RegistrationDataResources))]
        public string Password
        {
            get { return password; }
            set
            {
                if (this.password != value)
                {
                    Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "Password" });
                    password = value;
                }
            }
        }

        [Display(Name = "RememberMeLabel", ResourceType = typeof(ApplicationStrings))]
        public bool RememberMe
        {
            get { return rememberMe; }
            set
            {
                if (this.rememberMe != value)
                {
                    Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "RememberMe" });
                    rememberMe = value;
                }
            }
        }
    }
}
